/**
 * SpringMVC restful 风格
 * 财务管理 中 我的账户 充值 提现 索取发票 交易管理  线下支付  发票管理 支付方式设置 的一些业务逻辑操作
 * @author WangXinLei
 * @date 2014-09-23
 */
package com.chnbst.bstyun.controller.user;

import java.io.IOException;
import java.net.MalformedURLException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.dom4j.DocumentException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import com.chnbst.bstyun.core.common.DESUtil;
import com.chnbst.bstyun.core.common.ReadProperties;
import com.chnbst.bstyun.core.common.SignUtil;
import com.chnbst.bstyun.core.common.email.EmailUtil;
import com.chnbst.bstyun.eos.CreateNum;
import com.chnbst.bstyun.eos.Eos;
import com.chnbst.bstyun.model.pojo.Attach;
import com.chnbst.bstyun.model.pojo.Cashflow;
import com.chnbst.bstyun.model.pojo.Deal;
import com.chnbst.bstyun.model.pojo.Email;
import com.chnbst.bstyun.model.pojo.InvoiceModel;
import com.chnbst.bstyun.model.pojo.Payment;
import com.chnbst.bstyun.model.pojo.User;
import com.chnbst.bstyun.model.pojo.Voucher;
import com.chnbst.bstyun.model.vo.CashflowVo;
import com.chnbst.bstyun.model.vo.PaymentVo;
import com.chnbst.bstyun.service.AttachService;
import com.chnbst.bstyun.service.CashflowService;
import com.chnbst.bstyun.service.DealService;
import com.chnbst.bstyun.service.EmailService;
import com.chnbst.bstyun.service.InvoiceModelService;
import com.chnbst.bstyun.service.InvoiceService;
import com.chnbst.bstyun.service.PaymentService;
import com.chnbst.bstyun.service.UserService;
import com.chnbst.bstyun.service.VoucherService;

/**
 * 控制器注解 请求映射注解 controller 代表类是控制器 restcontroller 代表类是控制器， 所有的方法 都是ajax方法
 */
@Controller
@RequestMapping("/finance")
public class FinanceManageController {
	/*通话记录每页显示的条数*/
	private int callPageSize = 20;
	/*通话记录的页码*/
	private int callPage = 1;

	@Autowired
	private UserService userService;
	@Autowired
	private DealService dealService;
	@Autowired
	private CashflowService cashflowService;
	@Autowired
	private ReadProperties readProperties;
	@Autowired 
	private PaymentService paymentService;
	@Autowired
	private AttachService attachService;
	@Autowired
	private CreateNum createNum;
	@Autowired
	private VoucherService voucherService;
	@Autowired
	private EmailService emailService;
	@Autowired
	private Eos eos;
	@Autowired
	private InvoiceService invoiceService;
	@Autowired
	private InvoiceModelService invoiceModelService;
	
	private static final String DEAL_NAME="充值";
	
	/**
	 * @return 我的账户  主页面   /finance/myAccount  
	 * @throws Exception   
	 */ 
	@RequestMapping(value = "/myAccount", method = RequestMethod.GET)
	public ModelAndView myAccount(HttpServletRequest request) throws Exception {
		
		User user = (User)request.getSession().getAttribute("userInfo");
		
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("userId", user.getUserId());
		InvoiceModel invoiceModel = invoiceModelService.selectByCondition(map);
		
		ModelAndView modelAndView = new ModelAndView();
		modelAndView.setViewName("users/finance_manage/my_account/my_account");
		modelAndView.addObject("userInfo", user);
		
		modelAndView.addObject("invoiceModel", invoiceModel);
		
		return modelAndView;
	}
	
	/**
	 * @return 充值  主页面  /finance/recharge
	 * @throws Exception  
	 */ 
	@RequestMapping(value = "/recharge", method = RequestMethod.GET)
	public ModelAndView recharge(HttpServletRequest request) throws Exception {
		
		User user = (User)request.getSession().getAttribute("userInfo");
		
//		User userInfo = userService.selectUserInfoByUserId(user.getUserId());
		
		//放入公司信息
		request.getSession().setAttribute("BSTCOMPANYINFO", readProperties);
		
		ModelAndView modelAndView = new ModelAndView();
		modelAndView.setViewName("users/finance_manage/my_account/recharge");
		modelAndView.addObject("userInfo", user);
		
		return modelAndView;
	}
	
	/**
	 * get请求   充值用户的余额
	 * @throws IOException 
	 * @throws DocumentException 
	 * @throws MalformedURLException 
	 */
	@RequestMapping(value="/doRecharge",method=RequestMethod.GET)
	@ResponseBody
	public boolean doRecharge(Integer userId,Double rechargeNum,String voucherNum,HttpServletRequest request) throws MalformedURLException, DocumentException, IOException{

		User userMain = userService.selectUserInfoByUserId(userId);
		userMain.setAccountMoney(userMain.getAccountMoney() + rechargeNum);
		boolean b = userService.updateUserByKey(userMain);
		
		Voucher voucher = voucherService.selectByVoucherNum(voucherNum);
		voucher.setState(1);
		boolean c = voucherService.updateVoucher(voucher);
		
		Cashflow cashflow = new Cashflow();
		cashflow.setCashflowNum(createNum.createCashflowNum("1"));
		cashflow.setCreateTime(new Date());
		cashflow.setDealType(1);
		cashflow.setDisburseMoney(0.00);
		cashflow.setIncomeMoney(rechargeNum);
		cashflow.setOrderId(0);
		cashflow.setPayWayId(2);
		cashflow.setThenAccount(userMain.getAccountMoney());
		cashflow.setUserId(userMain.getUserId());
		cashflow.setIsCancel(0);
		boolean d = cashflowService.insertCashflow(cashflow);
		
		request.getSession().setAttribute("userInfo", userMain);
		
		if(b && c && d) return true;
		else return false;
	}
	
	/**
	 * @return 交易管理  主页面  /finance/trade
	 * @throws Exception  
	 */ 
	@RequestMapping(value = "/trade", method = RequestMethod.GET)
	public ModelAndView trade(HttpServletRequest request) throws Exception {
		
		ModelAndView modelAndView = new ModelAndView();
		modelAndView.setViewName("users/finance_manage/trade_manage/trade");
		return modelAndView;
	}
	
	/**
	 * @return 交易管理  根据条件查询  /finance/tradeByCondition
	 * @throws Exception  
	 */ 
	@RequestMapping(value = "/tradeByCondition", method = RequestMethod.POST)
	@ResponseBody
	public Map<String, Object> tradeByCondition(String initTradeDetail,String startTime,String endTime,HttpServletRequest request) throws Exception {
		User user = (User)request.getSession().getAttribute("userInfo");
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("userId",user.getUserId());
		GregorianCalendar newgc=new GregorianCalendar();
		if(("true").equals(initTradeDetail)){//初始化查询
			SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
			GregorianCalendar gc=new GregorianCalendar(); 
			gc.setTime(new Date()); 
			gc.add(2,-1); 
			Date lastDate = format.parse((format.format(gc.getTime())));
			newgc.setTime(new Date());
			newgc.add(5,+1);
			Date nowDate = format.parse((format.format(newgc.getTime())));
			map.put("lastDate", lastDate);
			map.put("nowDate", nowDate);
		}else {
			SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
			if(!startTime.equals("")&&startTime!=null){
				map.put("lastDate",format.parse(startTime));
			}else {
				map.put("lastDate",null);
			}
			if(!endTime.equals("")&&endTime!=null){
				Date endDate = format.parse(endTime);
				newgc.setTime(endDate);
				newgc.add(5,+1);
				Date newEndTime = format.parse((format.format(newgc.getTime())));
				map.put("nowDate",newEndTime);
			}else {
				map.put("nowDate",null);
			}
		}
		
		List<Deal> dList = dealService.selectDealsByCondition(map);
		
		Map<String, Object> data = new HashMap<String, Object>();
//		data.put("success", true);
		data.put("dList", dList);
		return data;
		
	}
	
	/**
	 * @return 现金收支管理  根据条件查询  /finance/balanceByCondition
	 * @throws Exception  
	 */ 
	@RequestMapping(value = "/balanceByCondition", method = RequestMethod.POST)
	@ResponseBody
	public Map<String, Object> balanceByCondition(String initTradeDetail,String startTime,String endTime,String dealType,HttpServletRequest request) throws Exception {
		User user = (User)request.getSession().getAttribute("userInfo");
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("userId",user.getUserId());
		GregorianCalendar newgc=new GregorianCalendar();
		if(("true").equals(initTradeDetail)){//初始化查询
			SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
			GregorianCalendar gc=new GregorianCalendar(); 
			gc.setTime(new Date()); 
			gc.add(2,-1); 
			Date lastDate = format.parse((format.format(gc.getTime())));
			newgc.setTime(new Date());
			newgc.add(5,+1);
			Date nowDate = format.parse((format.format(newgc.getTime())));
			map.put("lastDate", lastDate);
			map.put("nowDate", nowDate);
		}else {
			SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
			if(!startTime.equals("")&&startTime!=null){
				map.put("lastDate",format.parse(startTime));
			}else {
				map.put("lastDate",null);
			}
			if(!endTime.equals("")&&endTime!=null){
				Date endDate = format.parse(endTime);
				newgc.setTime(endDate);
				newgc.add(5,+1);
				Date newEndTime = format.parse((format.format(newgc.getTime())));
				map.put("nowDate",newEndTime);
			}else {
				map.put("nowDate",null);
			}
			map.put("dealType",dealType);
		}
		List<CashflowVo> cList = cashflowService.selectCashflowsByCondition(map);
		
		Map<String, Object> data = new HashMap<String, Object>();
//		data.put("success", true);
		data.put("dList", cList);
		return data;
		
	}
	
	
	/**
	 * @return 发送邮件给客户  以及本公司
	 * @throws Exception
	 */
	@RequestMapping(value = "/rechargeSendEmailToUser", method = RequestMethod.POST)
	@ResponseBody
	public boolean rechargeSendEmailToUser(String email,String company,String rechargeNumber,String linkMan,String linkPhone,
			String voucherNum,HttpServletRequest request) throws Exception {
		
		request.setCharacterEncoding("utf-8");
		User user = (User) request.getSession().getAttribute("userInfo");
		
		Double voucherMoney = 0.00;
		Double actrulMoney = Double.valueOf(rechargeNumber);
		if(SignUtil.isNotEmpty(voucherNum)){
			Voucher voucher = voucherService.selectByVoucherNum(voucherNum);
			voucher.setState(1);
			voucherService.updateVoucher(voucher);
			voucherMoney = voucher.getVoucherMoney();
			actrulMoney = actrulMoney - voucherMoney;
			
			User userMain = userService.selectUserInfoByUserId(user.getUserId());
			userMain.setAccountMoney(userMain.getAccountMoney() + voucherMoney);
			userService.updateUserByKey(userMain);
			
			Cashflow cashflow = new Cashflow();
			cashflow.setCashflowNum(createNum.createCashflowNum("1"));
			cashflow.setCreateTime(new Date());
			cashflow.setDealType(1);
			cashflow.setDisburseMoney(0.00);
			cashflow.setIncomeMoney(voucherMoney);
			cashflow.setOrderId(0);
			cashflow.setPayWayId(2);
			cashflow.setThenAccount(userMain.getAccountMoney());
			cashflow.setUserId(user.getUserId());
			cashflow.setIsCancel(0);
			cashflowService.insertCashflow(cashflow);
			
			request.getSession().setAttribute("userInfo", userMain);
			
		}
		
		String userInfoName = "";
		if(SignUtil.isNotEmpty(user.getUserEmail())){
			userInfoName = user.getUserEmail();
		}else{
			userInfoName = user.getUserTel();
		}
		
		boolean b = false;
		boolean c = false;
		boolean d = false;
		boolean e = false;
		
		//给客户发邮件  {"用户名","注册账号","充值金额","付款单位全称","付款单位联系人","付款单位联系电话","收款单位全称", "收款单位开户行","收款单位账户","收款单位服务电话"}
		Email emailTemp = emailService.selectEmail(33);
    	String content = emailTemp.getEmailContent();
    	content = content.replace("arg0", userInfoName).replace("arg1", userInfoName).
    			replace("arg2", String.valueOf(actrulMoney)).replace("arg3", company).
    			replace("arg4", linkMan).replace("arg5", linkPhone).replace("arg6", readProperties.getBstCompanyName()).
    			replace("arg7", readProperties.getBstBankNname()).replace("arg8", readProperties.getBstAccount()).replace("arg9", readProperties.getBstServiceTel());
    	b = EmailUtil.sendMail(email, emailTemp.getEmailSubject(), content+emailTemp.getEmailSign());
		
//    	b = EmailUtil.sendMailChargeOutline(email,new String[]{userInfoName,userInfoName,String.valueOf(actrulMoney),company,linkMan,linkPhone,readProperties.getBstCompanyName(),readProperties.getBstBankNname(),readProperties.getBstAccount(),readProperties.getBstServiceTel()});
		
		//公司发邮件       {"客户邮箱","注册账号","充值金额","付款单位全称","付款单位联系人","付款单位联系电话","收款单位全称", "收款单位开户行","收款单位账号","收款单位服务电话"}
    	Email emailTemp1 = emailService.selectEmail(38);
    	String content1 = emailTemp1.getEmailContent();
    	content1 = content1.replace("arg0", email).replace("arg1", userInfoName).
    			replace("arg2", String.valueOf(actrulMoney)).replace("arg3", company).
    			replace("arg4", linkMan).replace("arg5", linkPhone).replace("arg6", readProperties.getBstCompanyName()).
    			replace("arg7", readProperties.getBstBankNname()).replace("arg8", readProperties.getBstAccount()).replace("arg9", readProperties.getBstServiceTel());
    	c = EmailUtil.sendMail(readProperties.getBstCWEmail(), emailTemp1.getEmailSubject(), content1+emailTemp1.getEmailSign());
    	
//    	c = EmailUtil.sendMailtoBST(readProperties.getBstCWEmail(),new String[]{email,userInfoName,String.valueOf(actrulMoney),company,linkMan,linkPhone,readProperties.getBstCompanyName(),readProperties.getBstBankNname(),readProperties.getBstAccount(),readProperties.getBstServiceTel()});
				
		//新增线下支付记录
		Payment payment = new Payment();
		payment.setPaymentNum(createNum.createPaymentNum("1"));
		payment.setUserId(user.getUserId());
		payment.setAttachIds("");
		payment.setCreateTime(new Date());
		payment.setDealType(1);
		payment.setRemitCompany(company);
		payment.setLinkMan(linkMan);
		payment.setLinkTell(linkPhone);
		payment.setPaymentState(0);
		payment.setRemitMoney(Double.valueOf(rechargeNumber) - voucherMoney);
		payment.setIsCancel(0);
		
		e = paymentService.insertPayment(payment);
				
		if(b && c && e){
			return true;
		} else{
			return false;
		}
	}
	
	/**
	 * @return 现金收支管理  根据条件查询单条数据详情  /finance/balanceDetail
	 * @throws Exception  
	 */ 
	@RequestMapping(value = "/balanceDetail/{cashflowId}/{dealType}", method = RequestMethod.POST)
	@ResponseBody
	public Map<String, Object> balanceDetail(@PathVariable Integer cashflowId,@PathVariable Integer dealType,HttpServletRequest request){
		
		CashflowVo cashflowVo = cashflowService.selectByCashflowId(cashflowId);
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("cashflowVo", cashflowVo);
		return map;
	}
	
	/**
	 * @return 线下支付  /finance/payment
	 * @throws Exception  
	 */ 
	@RequestMapping(value = "/payment", method = RequestMethod.GET)
	public ModelAndView payment(HttpServletRequest request){
		
		User user = (User) request.getSession().getAttribute("userInfo");
		
		List<PaymentVo> pList = paymentService.selectPaymentByUserId(user.getUserId());
		
		ModelAndView modelAndView = new ModelAndView();
		modelAndView.setViewName("users/finance_manage/payment/payment");
		modelAndView.addObject("pList", pList);
		
		return modelAndView;
	}
	
	/**
	 * @return 线下支付  根据条件查询单条数据详情  /finance/paymentDetail
	 * @throws Exception  
	 */ 
	@RequestMapping(value = "/paymentDetail/{paymentId}", method = RequestMethod.POST)
	@ResponseBody
	public Map<String, Object> paymentDetail(@PathVariable Integer paymentId,HttpServletRequest request){
		
		PaymentVo paymentVo = paymentService.selectPaymentVoByPaymentId(paymentId);
		Map<String, Object> map = new HashMap<String, Object>();
		if(paymentVo.getAttachIds() != null && paymentVo.getAttachIds().length() > 0){
			String attachIds = paymentVo.getAttachIds();
			String str[] = attachIds.split("\\|");
			
			List<Attach> aList = new ArrayList<Attach>();
			
			for (int i = 0; i < str.length; i++) {
				Attach attach = attachService.selectAttachByAttachId(Integer.valueOf(str[i]));
				aList.add(attach);
			}
			map.put("aList", aList);
		}else{
			map.put("aList", null);
		}
		
		
		
		map.put("paymentVo", paymentVo);
		
		return map;
	}
	
	/**
	 * @return 线下支付  根据线下支付ID修改该条信息的附件信息  /finance/updatePayment
	 * @throws Exception  
	 */ 
	@RequestMapping(value = "/updatePayment/{paymentId}/{attachId}/{remitBank}/{remitTime}", method = RequestMethod.POST)
	@ResponseBody
	public Map<String, Object> updatePayment(@PathVariable Integer paymentId,@PathVariable String attachId,
			@PathVariable String remitBank,@PathVariable String remitTime,HttpServletRequest request){
		
		Map<String, Object> map = new HashMap<String, Object>();
		boolean c = false;
		
		Payment payment = paymentService.selectPaymentByPaymentId(paymentId);
		if(!payment.getAttachIds().isEmpty() && payment.getPaymentState() != 1){
			String attachIds = payment.getAttachIds();
			String str[] = attachIds.split("\\|");
			if(str.length < 2)
				payment.setAttachIds(payment.getAttachIds()+'|'+attachId);
			else {
				c = true;
			}
		}else{
			payment.setAttachIds(attachId);
		}
		payment.setPaymentState(1);
//		payment.setRemitTime(java.sql.Date.valueOf(remitTime));//(2014-12-22)
		payment.setRemitTime(SignUtil.str2Date(remitTime, "yyyy-MM-dd hh:mm:ss"));
		payment.setRemitBank(remitBank);
		
		boolean b = paymentService.updatePayment(payment);
		
		if(c){
			map.put("isMore", c);
		}else{
			map.put("isOk", b);
		}
		
		return map;
	}
	

	/**
	 * get请求    删除附件
	 */
	@RequestMapping(value="/deleteAttachById",method=RequestMethod.POST)
	@ResponseBody
	public  Map<String, Object>  deleteAttachById(Integer imgid,Integer paymentId,HttpServletRequest request){
		/**
		 * 删除 购物车 单条信息
		 */
		boolean b = attachService.deleteAttachByAttachId(imgid);
		boolean a = false;
		
		Payment payment = paymentService.selectPaymentByPaymentId(paymentId);
		if(!payment.getAttachIds().isEmpty()){
			String attachIds = payment.getAttachIds();
			String str[] = attachIds.split("\\|");
			String newAttachIds = "";
			for(int i=0;i<str.length;i++){
				if(!str[i].endsWith(String.valueOf(imgid))){
					String newStr[] = newAttachIds.split("\\|");
					if(newStr.length < 1)
						newAttachIds = newAttachIds + "|" + str[i];
					else 
						newAttachIds = str[i];
				}else{
					
				}
			}
			payment.setAttachIds(newAttachIds);
			Integer paymentState = 1;
			if(newAttachIds.length() < 1){
				paymentState = 0;
			}
			payment.setPaymentState(paymentState);
			a = paymentService.updatePayment(payment);
		}else{
			a = true;
		}
		
		@SuppressWarnings("unchecked")
		Map<String, Object> map = (Map<String, Object>)request.getSession().getAttribute("cartInfo");
		if(a && b)
			map.put("isSuccess", true);
		else 
			map.put("isSuccess", false);
		return map;
	}
	
	/**
	 * @return 余额分配  主页面  /finance/accountAssign
	 * @throws Exception  
	 */ 
	@RequestMapping(value = "/accountAssign", method = RequestMethod.GET)
	public ModelAndView accountAssign(HttpServletRequest request) throws Exception {
		
		ModelAndView modelAndView = new ModelAndView();
		modelAndView.setViewName("users/finance_manage/my_account/account_assign");
		return modelAndView;
	}
	
	/**
	 * @return 转充话费  主页面  /finance/turnBill
	 * @throws Exception  
	 */ 
	@RequestMapping(value = "/turnBill", method = RequestMethod.GET)
	public ModelAndView turnBill(HttpServletRequest request) throws Exception {
		
		ModelAndView modelAndView = new ModelAndView();
		modelAndView.setViewName("users/finance_manage/my_account/turn_bill");
		return modelAndView;
	}
	
	
	/**
	 * get请求   转充话费
	 * @throws Exception 
	 */
	@RequestMapping(value="/doTurnBill",method=RequestMethod.GET)
	@ResponseBody
	public boolean doTurnBill(Double turnNum,String paypw,HttpServletRequest request) throws Exception{
 
		String isSuccess = "ok";
		
		User user = (User) request.getSession().getAttribute("userInfo");
		User userMain = userService.selectUserInfoByUserId(user.getUserId());
		
		String pwd = DESUtil.encrypt(paypw);
		if(!userMain.getUserPassword().equals(pwd)){
			//密码错误
			isSuccess = "passwordError";
		}else{
			//设置话费
		}
		
		request.getSession().setAttribute("userInfo", userMain);
		
		return true;
	}
	
	/**
	 * @return 通话记录  主页面  /finance/callLog
	 * @throws Exception  
	 */ 
	@RequestMapping(value = "/callLog", method = RequestMethod.GET)
	public ModelAndView callLog(HttpServletRequest request) throws Exception {
		ModelAndView mav = new ModelAndView();
		mav.setViewName("users/finance_manage/call/call_log");
		return mav;
	}
	
	/**
	 * 通话记录  主页面加载数据
	 * @throws Exception 
	 */
	@RequestMapping(value="/searchBill",method=RequestMethod.POST)
	@ResponseBody
	public Map<String, Object> searchBill(String startime,String endtime,int page,HttpServletRequest request) throws Exception{
		if(SignUtil.isNotEmpty(startime)) {
			startime += "%2000:00:00";
		}
		if(SignUtil.isNotEmpty(endtime)) {
			endtime += "%2023:59:59";
		}
		User user = (User)request.getSession().getAttribute("userInfo");
		
		Map<String, Object> resultMap = eos.getBills(user.getVirtualPhone(),callPageSize,page,startime,endtime);
		resultMap.put("virtualPhone", user.getVirtualPhone());
		
		return resultMap;
	}
	
	/**
	 * @return 发票管理  主页面  /finance/invoice
	 * @throws Exception  
	 */ 
	@RequestMapping(value = "/invoice", method = RequestMethod.GET)
	public ModelAndView invoice(HttpServletRequest request) throws Exception {
		ModelAndView mav = new ModelAndView();
		User user = (User)request.getSession().getAttribute("userInfo");
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("userId", user.getUserId());
		InvoiceModel invoiceModel = invoiceModelService.selectByCondition(map);
		mav.addObject("invoiceModel", invoiceModel);
		mav.setViewName("users/finance_manage/invoice_manage/invoice");
		return mav;
	}
	
	/**
	 * @return 我的账户  提现 /finance/withdraw
	 * @throws Exception   
	 */ 
	@RequestMapping(value = "/withdraw", method = RequestMethod.GET)
	public ModelAndView withdraw(HttpServletRequest request) throws Exception {
		
		User user = (User)request.getSession().getAttribute("userInfo");
		
		ModelAndView modelAndView = new ModelAndView();
		modelAndView.setViewName("users/finance_manage/my_account/withdraw");
		modelAndView.addObject("userInfo", user);
		
		return modelAndView;
	}
}
